package main

import (
	"fmt"
	"strconv"
	"sync"
)

var (
	m  = sync.Map{}
	wg sync.WaitGroup
)

func main() {
	for i := 1; i <= 1000; i++ {
		wg.Add(1)
		go func(i int) {
			// 转化为字符串
			s := strconv.Itoa(i)
			m.Store(s, "value")
			value, _ := m.Load(s)
			fmt.Printf("k:%s,v:%s\n", s, value)
			wg.Done()
		}(i)
	}
	wg.Wait()
}
